package com.liugui.iostream;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @ClassName: Test2
 * @Author: liugui
 * @Date: 2020-11-09 09:18
 **/
public class Test2 {
    public static void main(String[] args) {
        Test2 test2 = new Test2();
        System.out.println("输入字符:");
        try {
            test2.copy(System.in,System.out);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void copy(InputStream in, OutputStream out) throws IOException {
        byte[] buf = new byte[4096];
        int len = in.read(buf);
        while (len != -1){
            out.write(buf,0,len);
            len = in.read(buf);
        }
    }

}
